home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: Question: Regards constructors, ptrs. and classes
- Date: 2 Feb 1996 12:02:55 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4esuhf$c6v@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe10.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Feb 02, 1996 00:49:19 in article <Question: Regards constructors, ptrs.
- and classes>, 'akm@red.seas.upenn.edu (The Killer)' wrote:
-
-
- >Please help! I am in an S.O.S. situation.
- >Here is the problem:
- >Base class...
- > class MORTGAGE{
- > MORTGAGE(.....blah, MORTGAGE*);
- > }
- >Derived class:
- >class TRAD_MORTGAGE{
- > TRAD_MORTGAGE(....blah, TRAD_MORTGAGE*)
- > }
- >
- If this is a derived class, your code snippet doesn't say so.
- I assume you have something like:
- class TRAD_MORTGAGE : public MORTGAGE { .. }
- and the closing semicolons after each class declaration.
-
- >Can I do this:
- > TRAD_MORTGAGE::TRAD_MORTGAGE(...blah, TRAD_MORTGAGE
- >*ptr):MORTGAGE(...blah, ptr){
- >}
- >
- Yes, the casting of a pointer from a subclass to its base class is
- trivial and done automatically by the compiler.
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-